@echo off
REM DDM构建脚本，自动设置Qt路径

echo 正在检测Qt安装路径...

REM 检查常见的Qt安装路径
set QT_PATH=
if exist "C:\Qt\6.9.1\msvc2022_64" (
    set QT_PATH=C:\Qt\6.9.1\msvc2022_64
    echo 找到Qt路径: %QT_PATH%
) else if exist "C:\Qt\6.8.0\msvc2022_64" (
    set QT_PATH=C:\Qt\6.8.0\msvc2022_64
    echo 找到Qt路径: %QT_PATH%
) else if exist "C:\Qt\6.7.0\msvc2022_64" (
    set QT_PATH=C:\Qt\6.7.0\msvc2022_64
    echo 找到Qt路径: %QT_PATH%
) else (
    echo 未找到Qt安装路径，请确保Qt6已正确安装
    echo 请从 https://www.qt.io/download 下载并安装Qt6
    pause
    exit /b 1
)

echo 正在配置项目...
cmake .. -DCMAKE_PREFIX_PATH=%QT_PATH%

if %errorlevel% neq 0 (
    echo CMake配置失败
    pause
    exit /b %errorlevel%
)

echo 项目配置完成!
echo 要构建项目，请运行以下命令:
echo   cmake --build . --config Release
echo 或者打开 DDM.sln 文件在Visual Studio中构建

pause